﻿// JavaScript Document
var s=5; 
var minheight=24; 
var maxheight=80; 
var a;
var b;
var count;

function shopcloseall(c,count)
{
    for(var i=1;i<=parseInt(count);i++)
    {
        var categall=document.getElementById("categ_"+i); 
        var keyall=document.getElementById("key"+i); 
        
        if(keyall.innerHTML=="关闭" && i!=c)
        { 
            var tall=categall.style;
            tall.height=minheight; 
            keyall.innerHTML="展开";
        }
    }
}

function shoppingcat(a,b)
{ 
  
  var categ=document.getElementById(a); 
  var key = document.getElementById(b); 
  var t=categ.style; 
  if(t.height==""||t.height==0) 
    t.height=minheight; 
  var h=parseInt(t.height); 
  if(key.innerHTML=="展开")
  { 
    h+=s; 
    t.height=h+"px"; 
    if(h<maxheight)
    { 
      setTimeout("shoppingcat('"+a+"','"+b+"');",1); 
    }
    else
    { 
      key.innerHTML="关闭"; 
    } 
  }
  else
  { 
    h-=s; 
    t.height=h+"px"; 
    if(h>minheight)
    { 
      setTimeout("shoppingcat('"+a+"','"+b+"');",1); 
    }
    else
    { 
      key.innerHTML="展开"; 
    } 
  } 
} 